<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sitemesh" uri="http://www.opensymphony.com/sitemesh/decorator" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>

<div class="panel_container">
    <div class="panel">
        <form id="form_password" method="post" action="${ctx}/system/configPassword">
            <input type="hidden" name="id"/>
            <div class="panel_header">
                <div><h2>系统密码配置</h2></div>
            </div>
            <div class="panel_body">
                <div>
                    <div>
                            <input type="hidden" name="loginCheckId" value="${configPasswordVo.loginCheckId}"/>
                            <input type="hidden" name="expireCheckId" value="${configPasswordVo.expireCheckId}"/>
                            <input type="hidden" name="samePasswordId" value="${configPasswordVo.samePasswordId}"/>
                            <input type="hidden" name="modifyPasswordId" value="${configPasswordVo.modifyPasswordId}"/>
                        <div class="info_item">
                            <input type="checkbox" name="loginCheck" value="1" <c:if test="${configPasswordVo.loginCheck=='Y'}">checked="checked"</c:if> /><span>输入3次错误密码是否自动锁定</span>
                        </div>
                        <div class="info_item">
                            <input type="checkbox" name="expireCheck" value="2" <c:if test="${configPasswordVo.expireCheck=='Y'}">checked="checked"</c:if>/><span>密码过期是否锁定</span>
                        </div>
                        <div class="info_item">
                            <input type="checkbox" name="samePassword" value="3" <c:if test="${configPasswordVo.samePassword=='Y'}">checked="checked"</c:if>/><span>一年内是否使用相同密码</span>
                        </div>
                        <div class="info_item">
                            <input type="checkbox" name="modifyPassword" value="4" <c:if test="${configPasswordVo.modifyPassword=='Y'}">checked="checked"</c:if>/><span>重置密码后用户是否必须修改密码</span>
                        </div>
                    </div>
                    <div>
                        <div class="info_item"><span>系统默认密码:<b>*</b></span>
                            <input type="text" name="defaultPassword" value="${configPasswordVo.defaultPassword}" />
                            <input type="hidden" name="defaultPasswordId" value="${configPasswordVo.defaultPasswordId}" />
                        </div>
                        <div class="info_item"><span>账户过期天数:<b>*</b></span>
                            <input type="text" name="expireDays" value="${configPasswordVo.expireDays}" />
                            <input type="hidden" name="expireDaysId" value="${configPasswordVo.expireDaysId}" />
                        </div>
                    </div>
                </div>

            </div>
            <div class="panel_footer">
                <div>
                    <input type="submit" value="保存" class="btn_blue" id="btn_save"/>
                </div>
            </div>
        </form>
    </div>
</div>
<script type="text/javascript">


    $(function (){
        
        $("#form_password").validate({
            rules:{
                defaultPassword: "required",
                expireDays: "required"
            },
            messages:{
                defaultPassword: "系统默认密码必填",
                expireDays: "账户过期天数必填"

            },
            submitHandler: function(form) {
                $(form).ajaxSubmit({
                    success: function(response) {
                        var data = $.parseJSON(response);
                    	if(data.result=="true"){
//                            jAlert('保存成功','提示');
                            $.prompt("保存成功");
                    	}
                    },

                    error: function(response){
                        $.prompt("保存失败:"+response,"错误");
                    }
                });
            }
        });

    });


</script>
